package com.xfcy.blog.common.enums;

/**
 * @author 晓风残月Lx
 * @date 2023/4/12 14:46
 */
public enum SearchEnum {

    /**
     * mysql 搜索
     */
    MYSQL(0, "mysql搜索", "mysqlStrategyImpl"),

    /**
     * elasticsearch搜索
     */
    ELASTICSEARCH(1, "elasticsearch搜索", "elasticsearchStrategyImpl");

    private final int type;
    private final String desc;
    private final String strategy;

    public int getType() {
        return type;
    }

    public String getDesc() {
        return desc;
    }

    public String getStrategy() {
        return strategy;
    }

    SearchEnum(int type, String desc, String strategy) {
        this.type = type;
        this.desc = desc;
        this.strategy = strategy;
    }


    public static String getStrategy(int type) {
        for (SearchEnum value : SearchEnum.values()) {
            if (value.getType() == type) {
                return value.getStrategy();
            }
        }
        return null;
    }

}
